package com.sysd.mail.pop;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

import java.net.SocketAddress;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * project: mail
 *
 * @author bsh
 * @description PopServerHandler
 * @dataTime 2022/12/16 15:52
 * @company 丽水信阳软件科技有限公司
 */
public class PopServerHandler extends SimpleChannelInboundHandler<String> {
    private final Map<SocketAddress, PopSession> sessionMap=new ConcurrentHashMap<>();
    private final PopCommandHandler popCommandHandler=new PopCommandHandler();

    /**
     * <strong>Please keep in mind that this method will be renamed to
     * {@code messageReceived(ChannelHandlerContext, I)} in 5.0.</strong>
     * <p>
     * Is called for each message of type {@link Object}.
     *
     * @param ctx the {@link ChannelHandlerContext} which this {@link SimpleChannelInboundHandler}
     *            belongs to
     * @param msg the message to handle
     * @throws Exception is thrown if an error occurred
     */
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, String msg) throws Exception {

    }

    /**
     * Do nothing by default, sub-classes may override this method.
     *
     * @param ctx the {@link ChannelHandlerContext} which this {@link SimpleChannelInboundHandler}
     *            belongs to
     */
    @Override
    public void handlerAdded(ChannelHandlerContext ctx) throws Exception {

    }
}
